import request from '@/config/axios'

// 外呼渠道 VO
export interface ChannelVO {
  id: number // 外呼渠道编号
  name: string // 渠道名称
  appId: string // appId
  appKey: string // appKey
  appSecret: string // appSecret
}

export const getChannelPage = async (params: any) => {
  return await request.get({ url: `/call/channel/page`, params })
}

export const getChannelList = async () => {
  return await request.get({ url: `/call/channel/simple-list` })
}

export const getChannel = async (id: number) => {
  return await request.get({ url: `/call/channel/get?id=` + id })
}

export const createChannel = async (data: ChannelVO) => {
  return await request.post({ url: `/call/channel/create`, data })
}

export const updateChannel = async (data: ChannelVO) => {
  return await request.put({ url: `/call/channel/update`, data })
}

export const deleteChannel = async (id: number) => {
  return await request.delete({ url: `/call/channel/delete?id=` + id })
}

export const exportChannel = async (params) => {
  return await request.download({ url: `/call/channel/export-excel`, params })
}
